package com.example.jetpacker.livedata

import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class LivedataViewModelTwo : ViewModel() {

    private val _counter = MutableLiveData<Int>()
    val counter: LiveData<Int> get() = _counter

    fun plusOne() {
        val count = _counter.value?:0
        _counter.value = count + 1
    }

    fun clear() {
        _counter.value=0
    }

}